﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Mendel
{
    public class Integer : Data
    {
        public int Value { get; private set; }

        public Integer(int v)
        {
            Value = v;
        }

        public override DType Type
        {
            get { return DType.Integer; }
        }

        public override Data Clone()
        {
            return new Integer(Value);
        }

        public override Data Convert(DType to)
        {
            switch (to)
            {
                case DType.Integer:
                    return this;
                case DType.Float:
                    return new Float(Value);
                case DType.String:
                    return new String(Value.ToString());
                case DType.List:
                    return new List(new Item[1] { Container });
                case DType.Word:
                    return new Word(new Item[1] { Container });
                case DType.Reference:
                    return new Reference(Container);
                default:
                    return this;
            }
        }
    }
}
